package cn.g31010.sip.vo
{
	import com.adobe.cairngorm.vo.IValueObject;
	import com.adobe.serialization.json.JSON;
	
	public class User implements IValueObject
	{
		
		public var id:String;
		
		public var name:String;
		
		public var nickName:String;
		
		public var passwd:String;
		
		public var registerTime:Number;
		
		public var lastLoginTime:Number;
		
		public var status:String;
		
		public var hessianTypeName:String = "cn.g31010.sip.pojo.User";
		
		public function User()
		{
		}
		
		public function toString():String{
			return JSON.encode(this);
		}
		
		public static function createFromJson(str:String):User{
			return create(JSON.decode(str));
		}

		public static function create(obj:Object):User{
			if(obj==null)
				return null;
			var u:User=new User();
			if(obj.hasOwnProperty("id")){
				u.id=String(obj.id);
			}
			if(obj.hasOwnProperty("name")){
				u.name=String(obj.name);
			}
			if(obj.hasOwnProperty("nickName")){
				u.nickName=String(obj.nickName);
			}
			if(obj.hasOwnProperty("passwd")){
				u.passwd=String(obj.passwd);
			}
			if(obj.hasOwnProperty("status")){
				u.status=String(obj.status);
			}
			if(obj.hasOwnProperty("registerTime")){
				u.registerTime=Number(obj.registerTime);
			}
			if(obj.hasOwnProperty("lastLoginTime")){
				u.lastLoginTime=Number(obj.lastLoginTime);
			}
			return u;
		}
	}
}